﻿using System.Security.Claims;
using B.S.BaseData.Api.Write.Application.Command.Deaths;
using B.S.BaseData.Api.Write.Application.Command.Eliminates;
using B.S.BaseData.Api.Write.Application.Command.Procurements;
using B.S.BaseData.Api.Write.Application.Command.Sale;
using BaseData.WriteApi.Appcontext.Command.DescendantFiles;
using BaseData.WriteApi.Appcontext.Command.Ewe_Files;
using BaseData.WriteApi.Appcontext.Command.EweHistoryRecord_Files;
using BaseData.WriteApi.Appcontext.Command.Initialform_Files;
using BaseData.WriteApi.Appcontext.Command.Ram_Files;
using BaseData.WriteApi.Appcontext.Command.Sheep_Records;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SmartTracking.API.Write.Application.CommandHandlers.Purchasing.Deaths;
using SmartTracking.API.Write.Application.CommandHandlers.Purchasing.Deaths;
using SmartTracking.API.Write.Application.Commands.Ewe_Files;
using SmartTracking.API.Write.Application.Commands.Ewemating;
using SmartTracking.API.Write.Application.Commands.Ewemating;
using SmartTracking.API.Write.Application.Commands.Permission_command;
using SmartTracking.API.Write.Application.Commands.PoultryHouse_command;
using SmartTracking.API.Write.Application.Commands.PoultryHouse_command;
using SmartTracking.API.Write.Application.Commands.Purchasing.Deaths;
using SmartTracking.API.Write.Application.Commands.Purchasing.Deaths;
using SmartTracking.API.Write.Application.Commands.Purchasing.Eliminates;
using SmartTracking.API.Write.Application.Commands.Role_command;
using SmartTracking.API.Write.Application.Commands.SheepFarm_command;
using SmartTracking.API.Write.Application.Commands.User;
using SmartTracking.API.Write.Application.Commands.User_command;
using SmartTracking.ApiWrite.Applications.Commands.Ewemating;
using SmartTracking.ErrorCode;

namespace SmartTracking.API.Write.Controllers
{
    /// <summary>
    /// API-控制器-写入
    /// </summary>
    [Route("api/[controller]/[action]")]
    [Authorize]
    [AllowAnonymous]
    [ApiController]
    public class ManagementController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly ILogger<ManagementController> logger;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator">中介者</param>
        /// <param name="logger">日志</param>
        public ManagementController(IMediator mediator, ILogger<ManagementController> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }

        #region 用户管理
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加用户任务</returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddUser(AddUserCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.CreateUserNo = UserNickName;
                logger.LogInformation($"{UserNickName}新增用户成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("添加用户失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回删除用户任务</returns>
        [HttpPost]
        public async Task<ApiResult<int>> DeleteUser([FromQuery]DeleteUserCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.DeleteUserNo = UserNickName;
                logger.LogInformation($"{UserNickName}删除用户成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("删除用户失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回更新用户任务</returns>
        [HttpPost]
        public async Task<ApiResult<int>> UpdateUser(UpdateUserCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.UpdateUserNo = UserNickName;
                logger.LogInformation($"{UserNickName}更新用户成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("更新用户失败" + ex.Message);
                throw;
            }
        }

        #endregion
        #region 角色管理
        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回角色管理</returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<ApiResult<int>> AddRole(AddRoleCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.CreateUserNo = UserNickName;

                logger.LogInformation($"{UserNickName}新增角色成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("新增角色失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 更新角色
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回更新角色任务</returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<ApiResult<int>> UpdateRole(UpdateRoleCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.UpdateUserNo = UserNickName;

                logger.LogInformation($"{UserNickName}更新角色成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("更新角色失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回删除角色任务</returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<ApiResult<int>> DeleteRole([FromQuery]DeleteRoleCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.DeleteUserNo = UserNickName;

                logger.LogInformation($"{UserNickName}删除角色成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("删除角色失败" + ex.Message);
                throw;
            }
        }
        #endregion

        #region 权限管理
        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加权限任务</returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<ApiResult<int>> AddPermission(AddPermissionCommand request)
        {
            try
            {
                logger.LogInformation("新增权限成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("新增权限失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 更新权限
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回更新权限任务</returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<ApiResult<int>> UpdatePermission(UpdatePermissionCommand request)
        {
            try
            {
                logger.LogInformation("更新权限成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("更新权限失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 删除权限
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回删除权限任务</returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<ApiResult<int>> DeletePermission([FromQuery] DeletePermissionCommand request)
        {
            try
            {
                logger.LogInformation("删除权限成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("删除权限失败" + ex.Message);
                throw;
            }
        }
        #endregion

        #region 羊场管理
        /// <summary>
        /// 添加羊场
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加羊场任务</returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddSheepFarm(AddSheepFarmCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.CreateUserNo = UserNickName;

                logger.LogInformation($"{UserNickName}新增羊场成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("新增羊场失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 删除羊场
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回删除羊场任务</returns>
        [HttpPost]
        public async Task<ApiResult<int>> DeleteSheepFarm([FromQuery]DeleteSheepFarmCommand request)
        {
            try
            {
                logger.LogInformation("删除羊场成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("删除羊场失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 更新羊场
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回更新羊场任务</returns>
        [HttpPost]
        public async Task<ApiResult<int>> UpdateSheepFram(UpdateSheepFramCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.UpdateUserNo = UserNickName;

                logger.LogInformation($"{UserNickName}更新羊场成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("更新羊场失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 添加栋舍
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加栋舍任务</returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddPoultryHouse(AddPoultryHouseCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.CreateUserNo = UserNickName;
                logger.LogInformation($"{UserNickName}添加栋舍成功");

                return await mediator.Send(request); 
            }
            catch (Exception ex)
            {
                logger.LogError("添加栋舍失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 删除栋舍
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回删除栋舍任务</returns>
        [HttpPost]
        public async Task<ApiResult<int>> DeletePouitryHouse([FromQuery]DeletePouitryHouseCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.DeleteUserNo = UserNickName;
                logger.LogInformation($"{UserNickName}删除栋舍成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("删除栋舍失败" + ex.Message);
                throw;
            }
        }
        /// <summary>
        /// 更新栋舍
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回更新栋舍命令</returns>
        [HttpPost]
        public async Task<ApiResult<int>> UpdatePoultryHouse(UpdatePoultryHouseCommand request)
        {
            try
            {
                string UserNickName = User.FindFirstValue("UserNickName");
                request.UpdateUserNo = UserNickName;
                logger.LogInformation($"{UserNickName}更新栋舍成功");
                return await mediator.Send(request);
            }
            catch (Exception ex)
            {
                logger.LogError("更新栋舍失败" + ex.Message);
                throw;
            }
        }
        #endregion

        #region 母羊配种管理
        /// <summary>
        /// 添加母羊配种
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加信息</returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddEwemating(AddBatchEwematingCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 更新母羊配种
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateEwemating(UpdateEwematingCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 删除母羊配种
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回删除信息</returns>
        [HttpDelete]
        public async Task<ApiResult<int>> DeleteEwemating(int EwematingId)
        {
            DeleteEwematingCommand request = new DeleteEwematingCommand { EwematingId = EwematingId };
            return await mediator.Send(request);
        }
        /// <summary>
        /// 删除母羊妊检
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回删除信息</returns>
        [HttpDelete]
        public async Task<ApiResult<int>> DeletePregnancys([FromQuery] DeletePregnancysCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 批量添加母羊妊检
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns></returns>
        [HttpPost]  
        public async Task<ApiResult<int>> AddBatchPregnancys(AddBatchPregnancysCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 更新母羊妊检
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdatePregnancys(UpdatePregnancysCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 批量添加母羊分娩
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddBatchEwedeliverys(AddBatchEwedeliverysCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 批量添加母羊断奶
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddBatchWeanings(AddBatchWeaningsCommand request)
        {
            return await mediator.Send(request);
        }
        
        #endregion

        #region 采购羊只管理
        /// <summary>
        /// 添加采购
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加信息</returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreateProcurement(CreateProcurementCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改采购
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateProcurement(UpdateProcurementCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 删除采购信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public Task<ApiResult<int>> DeleteProcurement([FromQuery] DeleteProcurementCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 添加销售
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加信息</returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreateSale(CreateSaleCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改销售
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateSales(UpdateSalesCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 删除销售信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public Task<ApiResult<int>> DeleteSales([FromQuery]DeleteSalesCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 添加死亡
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加信息</returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreateDeath(CreateDeathCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改死亡
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateDeath(UpdateDeathCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 删除死亡信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public Task<ApiResult<int>> DeleteDeath([FromQuery]DeleteDeathCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 添加淘汰
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回添加信息</returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreateEliminate(CreateEliminateCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改淘汰
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateEliminate(UpdateEliminateCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 删除淘汰信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public Task<ApiResult<int>> DeleteEliminate([FromQuery]DeleteEliminateCommand request)
        {
            return mediator.Send(request);
        }
        #endregion

        #region 羊只信息管理

        /// <summary>
        /// 创建后代信息
        /// </summary>
        /// <param name="cmd">创建后代请求</param>
        /// <returns>处理结果</returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreatedDescendant(CreateDescendantFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 创建母羊档案
        /// </summary>
        /// <param name="cmd">创建母羊档案请求</param>
        /// <returns>处理结果</returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreatedEweFile(CreateEweFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 创建公羊档案
        /// </summary>
        /// <param name="cmd">创建公羊档案请求</param>
        /// <returns>处理结果</returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreatedRamFile(CreateRamFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 创建羊只档案
        /// </summary>
        /// <param name="cmd">创建羊只档案请求</param>
        /// <returns>处理结果</returns>
        [HttpPost]
        public async Task<ApiResult<int>> CreatedSheepRecord(CreateSheepRecordCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 删除羊只档案
        /// </summary>
        /// <param name="cmd">删除羊只档案请求</param>
        /// <returns>处理结果</returns>
        [HttpDelete]
        public async Task<ApiResult<bool>> DeleteSheepRecord([FromBody] DeleteSheepRecordCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 更新羊只档案
        /// </summary>
        /// <param name="cmd">更新羊只档案请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateSheepRecord([FromBody] UpdateSheepRecordCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 删除后代档案
        /// </summary>
        /// <param name="cmd">删除后代档案请求</param>
        /// <returns>处理结果</returns>
        [HttpDelete]
        public async Task<ApiResult<bool>> DeleteDescendant([FromBody] DeleteDescendantFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 更新后代档案
        /// </summary>
        /// <param name="cmd">更新后代档案请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateDescendant([FromBody] UpdateDescendantFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 删除母羊档案
        /// </summary>
        /// <param name="cmd">删除母羊档案请求</param>
        /// <returns>处理结果</returns>
        [HttpDelete]
        public async Task<ApiResult<bool>> DeleteEweFile([FromBody] DeleteEweFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 更新母羊档案
        /// </summary>
        /// <param name="cmd">更新母羊档案请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateEweFile([FromBody] UpdateEweFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 删除公羊档案
        /// </summary>
        /// <param name="cmd">删除公羊档案请求</param>
        /// <returns>处理结果</returns>
        [HttpDelete]
        public async Task<ApiResult<bool>> DeleteRamFile([FromBody] DeleteRamFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 更新公羊档案
        /// </summary>
        /// <param name="cmd">更新公羊档案请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateRamFile([FromBody] UpdateRamFileCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 批量创建初期表单
        /// </summary>
        /// <param name="cmd">批量创建初期表单请求</param>
        /// <returns>处理结果</returns>
        [HttpPost]
        public async Task<ApiResult<List<int>>> CreateInitialformBatch([FromBody] CreateInitialformBatchCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 修改后裔档案初期状态
        /// </summary>
        /// <param name="cmd">修改后裔档案初期状态请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateDescendantInitialstate([FromBody] UpdateDescendantInitialstateCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 修改母羊档案初期状态
        /// </summary>
        /// <param name="cmd">修改母羊档案初期状态请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateEweInitialstate([FromBody] UpdateEweInitialstateCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 修改公羊档案初期状态
        /// </summary>
        /// <param name="cmd">修改公羊档案初期状态请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateRamInitialstate([FromBody] UpdateRamInitialstateCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 更新初期表单
        /// </summary>
        /// <param name="cmd">更新初期表单请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateInitialform([FromBody] UpdateInitialformCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 删除初期表单
        /// </summary>
        /// <param name="cmd">删除初期表单请求</param>
        /// <returns>处理结果</returns>
        [HttpDelete]
        public async Task<ApiResult<bool>> DeleteInitialform([FromBody] DeleteInitialformCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 创建种母历史记录
        /// </summary>
        /// <param name="cmd">创建种母历史记录请求</param>
        /// <returns>处理结果</returns>
        [HttpPost]
        public async Task<ApiResult<bool>> CreateEweHistoryRecord([FromBody] CreateEweHistoryRecordCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 更新种母历史记录
        /// </summary>
        /// <param name="cmd">更新种母历史记录请求</param>
        /// <returns>处理结果</returns>
        [HttpPut]
        public async Task<ApiResult<bool>> UpdateEweHistoryRecord([FromBody] UpdateEweHistoryRecordCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 删除种母历史记录
        /// </summary>
        /// <param name="cmd">删除种母历史记录请求</param>
        /// <returns>处理结果</returns>
        [HttpDelete]
        public async Task<ApiResult<bool>> DeleteEweHistoryRecord([FromBody] DeleteEweHistoryRecordCommand cmd)
        {
            return await mediator.Send(cmd);
        }
        #endregion


    }
}
